package com.galen.dao;

import com.galen.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 用户dao
 *
 * @author GalenGao
 * @version Id: UserDao.java, v 0.1 2022/6/26 12:05 GalenGao Exp $$
 */
public interface UserDao extends JpaRepository<User,Long> , JpaSpecificationExecutor<User> {

    /**
     * 根据用户名查询用户
     * @param userName userName
     * @return User
     */
    User findByUsername(String userName);

    @Query(value = "update User set password=:password where username=:username")
    @Modifying
    int updatePassword(String password,String username);
}
